<?php

include_once('connect.php');
$str = $_GET['content'];

if ($str != "") {
    $strSQL = "SELECT tensp FROM sanpham "
            . "WHERE ghichu='hienthi' "
            . "AND hinh LIKE '%" . trim($str) . "%' "
            . "AND id LIKE '%" . trim($str) . "%' "
            . "OR tensp LIKE '%" . trim($str) . "%'";
    $sel = mysqli_query($conn, $strSQL);
    if (mysqli_num_rows($sel)) { ?>
        <table border ="0" width="100%">
        <?php if (mysqli_num_rows($sel)) { ?>
            <script language="javascript">box('1');</script>
            <?php while ($row = mysqli_fetch_array($sel)) {
                $country = str_ireplace($str, "<b>" . $str . "</b>", ($row['tensp'])); ?>
                echo "<tr id=\"word" . $row['id'] . "\" onmouseover=\"highlight(1,'" . $row['id'] . "');\" onmouseout=\"highlight(0,'" . $row['id'] . "');\" onClick=\"display('" . $row['tensp'] . "');\" >\n<td>" . $country . "</td>\n</tr>\n";
            }
        }
        echo "</table>";
    }
} else { ?>
    <script language="javascript">box('0');</script>
<?php } ?>